st = input()
lst = []
f = 0
o = 0
c = 0
for i in st:
    if i == "(" or i == '[' or i == '{' or i == '<':
        lst.append(i)
        o += 1
    else:
        a = lst.pop(-1)
        if a == '[':
            if i == ']':
                continue
            else:
                f = 1
                break 
        if a == '(':
            if i == ')':
                continue
            else:
                f = 1
                break
        if a == '{':
            if i == '}':
                continue
            else:
                f = 1
                break
        if a == '<':
            if i == '>':
                continue
            else:
                f = 1
                break

if f == 0 and len(st) % 2 == 0:
    print('True')
else:
    print('False')
